package demo.controller
{
	import data.app.DataController;
	import data.app.events.user.UserEvent;
	
	import demo.model.DemoModel;
	import demo.model.SceneModel;
	import demo.view.DemoMain;
	import demo.view.ViewBase;
	
	public class DemoController extends ViewBase
	{
		private var _model:DemoModel;
		private var _sceneModel:SceneModel;
		private var _demoMain:DemoMain;
		
		public function DemoController()
		{
		}
		
		override public function initialize():void
		{
			super.initialize();
			_model = new DemoModel();
			_sceneModel=new SceneModel();
			_demoMain = new DemoMain(this,_model, _sceneModel);
			_demoMain.show();
		}
		
		/**
		 *事件设置 
		 */		
		override public function setEvent():void
		{
			super.setEvent();
			DataController.Instance.dataReceive.userReceiveData.addEventListener(UserEvent.USER_LOGIN, userLoginReceive);
		}
		
		/**
		 *用户登陆 
		 */		
		public function userLogin(userName:String):void
		{
			DataController.Instance.dataSend.userSendData.login(userName);
		}
		
		/**
		 *用户登陆数据返回
		 */		
		public function userLoginReceive(evt:UserEvent):void
		{
			
		}
		
		/**
		 *资源释放 
		 */		
		override public function dispose():void
		{
			super.dispose();
			DataController.Instance.dataReceive.userReceiveData.removeEventListener(UserEvent.USER_LOGIN, userLoginReceive);
		}
	}
}